package com.yfs.cloud.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.yfs.cloud.interceptor.AuthInterceptor;

/**
* @Company: 影法師工作室
* @Description: 拦截器配置类, 对于微服务而言, 只需要加入鉴权拦截器即可
* @author 影法師  
* @date 2020年8月25日 上午10:44:36 
* @version V1.0
 */
@Configuration // 必须要注入容器
public class InterpretorConfig implements WebMvcConfigurer {

	@Autowired
	private AuthInterceptor authInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// 鉴权拦截器, 拦截所有路径
		registry.addInterceptor(authInterceptor).addPathPatterns("/**");
		WebMvcConfigurer.super.addInterceptors(registry);
	}

}
